﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MultiValueConverter {
    /// <summary>
    /// Lógica de interacción para MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e) {
            Evento evt = (Evento)this.Resources["evento"];
            MessageBox.Show("Evento: " + evt.anno);

        }
    }

    public class Evento {
    private String _nombre;
    private String _descripcion;
    private String _dia;
    private String _mes;
    private String _anno;
    
        private DateTime _hora;

    public Evento() {
        this._nombre = "Partido Venezuela vs. España";
        this._descripcion = "Partido Venezuela vs. España que se jugara la semana que viene, transmicion de XXX tv";
        this._hora = new DateTime(2011, 07, 07);
        this._dia = "07";
        this._mes = "07";
        this._anno = "2011";
    }

    public String nombre{
    get {return _nombre;}
    set{_nombre= value; }    
    }

    public String descripcion {
        get { return _descripcion; }
        set { _descripcion = value; }
    }

    public String dia {
        get { return _dia; }
        set { _dia = value; }
    }
    public String mes{
        get { return _mes; }
        set { _mes = value; }
    }
    public String anno{
        get { return _anno; }
        set { _anno = value; }
    }

    public DateTime hora {
        get { return _hora; }
        set { _hora = value; }
    }
    }

    public class ConverHora: IMultiValueConverter {

        object IMultiValueConverter.Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) {

            return values[0]+"/"+values[1]+"/"+values[2];
        }

        object[] IMultiValueConverter.ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) {
            return value.ToString().Split('/');
        }
    }



}
